Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanity Manual Compilation #6991

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Sanity Manual Compilation #6991

wants to merge 2 commits into from

Conversation

sgn
Copy link

@sgn sgn commented Sep 2, 2022

This PR consists of 2 changes, the first change allows building manual this all target with touching anything outside build-directory. The second change adds support for cross compilation via qemu.

Current code base will always install nix into $(prefix) when make which is undesirable, since it may override the nix (assumed-to-be-good) installed in $(prefix) by the under-development nix (could be buggy) unconditionally.

The first change aimed to fix it, the second change is a bonus change that depends on the first change.

Current manual needs nix installed into $(bindir) which could be
non-writable if $(prefix) set to root-owned directory like /usr or
/usr/local. In addition, half-baked nix could override the good nix
that installed in $(prefix).

Let's run $(nix_DIR)/nix instead of $(bindir)/nix.
@sgn
Copy link
Author

sgn commented Sep 2, 2022

Downstream patches from void-linux/void-packages#39050

Copy link
Member

@thufschmitt thufschmitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The qemu bits is very nice :)

The use of the locally built nix is more annoying because of an idiosyncrasy of the build system: $(nix_DIR)/nix and $(bindir)/nix are two separate executables (linked with different flags), and make install currently never builds $(nix_DIR)/nix. This change would make it necessary to build it too, which is annoying since the linking phase is far from cheap.

Ideally I'd really like to get rid of this weirdness and have make install just copy (and patchelf if needs be) the result of make, but that's another topic

@edolstra
Copy link
Member

edolstra commented Sep 6, 2022

I would rather get rid of the non-make install build to simplify things. IIRC simply copying the binary doesn't work because the installed binary needs a different RPATH.

@sgn
Copy link
Author

sgn commented Sep 6, 2022

I would rather get rid of the non-make install build to simplify things. IIRC simply copying the binary doesn't work because the installed binary needs a different RPATH.

But that would make life harder for those people who want to use a stable nix by distros channel.

@thufschmitt
Copy link
Member

IIRC simply copying the binary doesn't work because the installed binary needs a different RPATH.

I'm no expert in the field, but isn't that a fairly common and mostly solved problem, either by using relative rpaths or patching the rpath at install time?

@fricklerhandwerk fricklerhandwerk added documentation contributor-experience Developer experience for Nix contributors labels Sep 9, 2022
@eli-schwartz
Copy link
Contributor

The first commit is just #5145 and again #6015

Previous efforts that actually used a different tactic include:
#5185
#6005

Issues include:
#5140
#5184
#5781

@eli-schwartz
Copy link
Contributor

The actual fix will come as a side effect of #3160 since Meson internally handles both rpath and LD_LIBRARY_PATH and guarantees that build executables can be run by other build rules.

@stale stale bot added the stale label May 21, 2023
@Ericson2314 Ericson2314 self-assigned this Jun 23, 2023
@stale stale bot removed the stale label Jun 23, 2023
@Ericson2314
Copy link
Member

The first commit is handled by #5145, you should rebase on top for it.

@Ericson2314 Ericson2314 marked this pull request as draft November 30, 2023 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor-experience Developer experience for Nix contributors documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants